package al4th.chp1;

import al4th.StdLib.In;
import al4th.StdLib.StdIn;
import al4th.StdLib.StdOut;

import java.util.Arrays;

/**
 * @Author: wanghongfu
 * @Date : Created in 21:59  2017/10/13
 * @Email : 1583505981@qq.com
 * @Description :
 */
public class BinarySearch {
    public static void main(String[] args) {
        int[] whitelist= In.readInts(args[0]);
        Arrays.sort(whitelist);
        while (!StdIn.isEmpty()){
            int key=StdIn.readInt();
            if (rank(key,whitelist)<0){
                StdOut.println(key);
            }
        }
    }
    public static  int rank(int key,int[] a){
        int lo=0;
        int hi=a.length-1;
        while(lo<=hi){
            int mid=lo+(hi-lo)/2;
            if (key<a[mid]) hi=mid-1;
            else if(key>a[mid]) lo=mid+1;
            else  return  mid;
        }
        return  -1;
    }
}
